﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Xml.Serialization;
using Deployment.Manager.Configuration;
using PSE.Framework.Common;

namespace Deployment.BuildManager.ExternalProcess.Common
{
    [Serializable]
    [XmlInclude(typeof(PSE.Deployment.SetupBase.Configuration.Actions.Copy))]
    [XmlInclude(typeof(PSE.Deployment.SetupBase.Configuration.Actions.CreateShortcut))]
    [XmlInclude(typeof(PSE.Deployment.SetupBase.Configuration.Actions.InstallAssembly))]
    [XmlInclude(typeof(PSE.Deployment.SetupBase.Configuration.Actions.InstallCertificate))]
    [XmlInclude(typeof(PSE.Deployment.SetupBase.Configuration.Actions.InstallWcfService))]
    [XmlInclude(typeof(PSE.Deployment.SetupBase.Configuration.Actions.InstallWindowsService))]
    [XmlInclude(typeof(PSE.Deployment.SetupBase.Configuration.Actions.RegisterComponent))]
    [XmlInclude(typeof(PSE.Deployment.SetupBase.Configuration.Actions.RegisterComponentWin32))]
    [XmlInclude(typeof(PSE.Deployment.SetupBase.Configuration.Actions.UpdateConfig))]
    [XmlInclude(typeof(PSE.Deployment.SetupBase.Configuration.Actions.UpdateWindowsRegistry))]
    [XmlInclude(typeof(PSE.Deployment.SetupBase.Configuration.Actions.InstallMessageQueue))]
    public class SetupInfo : DeployInfo
    {
        #region CONSTRUCTORS

        public SetupInfo()
        {
            this.TFSDownloadedFiles = new List<SourceItem>();
            this.CompiledFiles = new List<ResourceItem>();
            this.BuildDescriptions = new List<string>();
        }

        #endregion

        #region PROPERTIES

        /// <summary>
        /// Descrição do build que aparecerá na execução do setup (lista de bugs)
        /// </summary>
        public List<string> BuildDescriptions { get; set; }

        /// <summary>
        /// The XML file for Setup.exe
        /// </summary>
        public string SetupConfigurationXmlPath { get; set; }

        /// <summary>
        /// Path where the files from the Team Foundation Server will be downloaded.
        /// </summary>
        public string DownloadPath { get; set; }

        /// <summary>
        /// Caminho onde os assemblies serão compilados.
        /// </summary>
        public string CompiledPath
        {
            get
            {
                return this.DownloadPath + Path.DirectorySeparatorChar + BuildConstants.CompiledFolder;
            }
        }

        /// <summary>
        /// Caminho do setup.
        /// </summary>
        public string SetupPath
        {
            get
            {
                return this.DownloadPath + Path.DirectorySeparatorChar + BuildConstants.SetupFolder;
            }
        }

        /// <summary>
        /// Uri do Projeto de Setup
        /// </summary>
        public string SetupUri { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public string HtxSpkVersion { get; set; }

        /// <summary>
        /// Caminho onde os assemblies serão separados para empacotamento.
        /// </summary>
        public string PackingPath { get; set; }

        /// <summary>
        /// Caminho onde os assemblies compilados estao versionados.
        /// </summary>
        public string CompiledUri { get; set; }

        /// <summary>
        /// Caminho onde foi baixado o projeto template de setup.
        /// </summary>
        public string SetupTemplateProjectPath
        {
            get
            {
                return this.DownloadPath + BuildConstants.SetupTemplateSourceFolder;
            }
        }

        /// <summary>
        /// Caminho onde o projeto CreateSetup foi baixado.
        /// </summary>
        public string SetupTemplateProjectFolder { get; set; }

        /// <summary>
        /// Caminho onde o Setup.exe será gerado.
        /// </summary>
        public string GeneratedSetupPath { get; set; }

        /// <summary>
        /// Caminho onde os arquivos de logs serão salvos.
        /// </summary>
        public string LogFilePath
        {
            get { return this.DownloadPath + @"\log\"; }
        }

        /// <summary>
        /// Caminho onde o projeto CreateSetup está versionado.
        /// </summary>
        public string TemplateProjectUri { get; set; }

        /// <summary>
        /// Nome do produto.
        /// </summary>
        public string ProductName { get; set; }

        /// <summary>
        /// Sigla do Modulo.
        /// </summary>
        public string ModuleName { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public string PackageTitle { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public List<ResourceItem> CompiledFiles { get; set; }

        /// <summary>
        /// Os arquivos baixados da Team Foundation que devem ser apenas copiados para a pasta de distribuição.
        /// </summary>
        public List<SourceItem> TFSDownloadedFiles { get; set; }

        public PSE.Framework.Common.Version BuildVersion { get; set; }

        #endregion
    }
}
